const fs = require("fs");
const app = require("../app");

const userouter = (app) => {
  fs.readdirSync(__dirname).forEach((file) => {
    if (file === "index.js") return;

    const fileRouter = require(`./${file}`);
    app.use(fileRouter.routes());
    app.use(fileRouter.allowedMethods());
  });
};

module.exports = userouter